/* eslint-disable no-shadow */
const base = 'biz.scenes.statistics';
export function count({ search }) {
  return RSocket.rr({
    route: `${base}.count`,
    args: { search },
  });
}

export function search({ search, pg }) {
  return RSocket.rs({
    route: `${base}`,
    args: { search, pg },
  });
}

export function get(id) {
  return RSocket.rr({
    route: `${base}.${id}`,
  });
}

export function update(channel) {
  return RSocket.rr({
    route: `${base}.update`,
    data: channel,
  });
}

export function create(channel) {
  return RSocket.rr({
    route: `${base}.create`,
    data: channel,
  });
}

export function remove(id) {
  return RSocket.rr({
    route: `${base}.${id}.delete`,
  });
}

/**
 * 获取行为列表
 * @param {*} id
 * @returns
 */
export function getActives({ search, pg }) {
  return RSocket.rs({
    route: 'biz.actives',
    args: { search, pg },
  });
}

/**
 * 获取行为统计
 * @param {*} id
 * @returns
 */
export function getActivesCount({ search }) {
  return RSocket.rr({
    route: 'biz.actives.count',
    args: { search },
  });
}

/**
 * 查询身份信息
 * @param {*} id
 * @returns
 */
export function getInviteCode(inviteCode) {
  return RSocket.rr({
    route: `users.invite-code.${inviteCode}`,
  });
}

/**
 * 查询商户信息
 * @param {*} id
 * @returns
 */
export function getMerchants(id) {
  return RSocket.rr({
    route: `biz.merchants.${id}`,
  });
}

